function YHPlace(){
	this.Type = YHConstants.scene.mode.unknown;
	var Title = "";
	this.getTitle = function(){
		return Title;
	};
	
	this.setTitle = function(title){
		Title = title;
		return this;
	};
	var divItem = null;
	var top = 0;
	this.setTop = function(num){
		top = num;
		if(divItem)
			divItem.css('top', num+'px');
		return this;
	};
	this.getTop = function(){
		if(divItem)
			return divItem.position().top;
		return top;
	};
	var left = 0;
	this.setLeft = function(num){
		left = num;
		if(divItem)
			divItem.css('left', num+'px');
		return this;
	};
	this.getLeft = function(){
		if(divItem)
			return divItem.position().left;
		return left;
	};
	var width = YHConstants.layout.width;
	var WidthHalf = width / 2;

	this.setWidth = function(num){
		width = num;
		WidthHalf = num / 2;
		if(divItem)
			divItem.css('width', num + "px");
		return this;
	};
	this.getWidth = function(){
		if(divItem)
			return  divItem.width();
		return width;
	};
	this.getWidthHalf = function(){
		if(!WidthHalf)
			WidthHalf = this.getWidth() / 2;
		return WidthHalf;
	};
	var height = YHConstants.layout.height;
	var HeightHalf = height / 2;
	this.setHeight = function(num){
		height = num;
		HeightHalf = num / 2;
		if(divItem)
			divItem.css('height', num+'px');
		return this;
	};
	this.getHeight = function(){
		if(divItem)
			return divItem.height();
		return height;
	};
	this.getHeightHalf = function(){
		if(!HeightHalf)
			HeightHalf = this.getHeight() / 2;
		return HeightHalf;
	};
	var StartX = YHConstants.scene.playerstart.x;
	this.getStartX = function() {
		return StartX;
	};
	this.setStartX = function(val) {
		StartX = val;
		return this;
	};
	
	var StartY = YHConstants.scene.playerstart.y;
	this.getStartY = function() {
		return StartY;
	};
	this.setStartY = function(val) {
		StartY = val;
		return this;
	};
	
	var LeftLocation = null;
	this.getLeftLocation = function() {
		return this.LeftLocation;
	};
	this.setLeftLocation = function(loc) {
		this.LeftLocation = loc;
		return this;
	};
	var RightLocation = null;
	this.setRightLocation = function(loc) {
		this.RightLocation = loc;
		return this;
	};
	this.getRightLocation = function() {
		return this.RightLocation;
	};
	var TopLocation = null;
	this.setTopLocation = function(loc) {
		this.TopLocation = loc;
		return this;
	};
	this.getTopLocation = function() {
		return this.TopLocation;
	};
	var BottomLocation = null;
	this.setBottomLocation = function(loc) {
		this.BottomLocation = loc;
		return this;
	};
	this.getBottomLocation = function() {
		return this.BottomLocation;
	};
	this.Draw = function() { };
	YumeHikkiEngine.Scene = this;
	this.divFloor = null;
	this.getDivItem = function() {
		return divItem;
	};
	this.setDivItem = function(newDivItem) {
		divItem = newDivItem;
		return this;
	};
	var Transparent = true;
	this.isTransparent = function(){
		return Transparent;
	};
	this.getTransparent = function(){
		return Transparent;
	};
	this.setTransparent = function(val){
		Transparent = val;
		return this;
	};
	this.divFloor = null;
}

function YHScene(title){
	this.Inherits(YHPlace);
	this.Type = YHConstants.scene.mode.scene;
	this.setTitle(title);
	this.setTopLocation(location.href);
	this.setBottomLocation(location.href);
	this.setLeftLocation(location.href);
	this.setRightLocation(location.href);
	this.Draw = function() {
		var divElemDoorMain=document.createElement('div');
		YumeHikkiEngine.getMainWrapper().addClass(this.Title);
		this.divFloor = $(divElemDoorMain);
		this.divFloor.addClass('YHScene');
		this.divFloor.css("width", this.getWidth());
		this.divFloor.css("height", this.getHeight());
		this.divFloor.appendTo(YumeHikkiEngine.getMainWrapper());
		this.setDivItem(this.divFloor);
	};
}

function YHRoom(title){
	this.Inherits(YHPlace);
	this.Type = YHConstants.scene.mode.room;
	this.setTitle(title);
	var WallHeight = YHConstants.layout.wallheight;
	var divWallMain = null;
	this.setWallHeight = function(num){
		WallHeight = num;
		if(this.divFloor && this.divWallMain)
		{
			this.divWallMain.css('height', num + "px");
			this.divFloor.css('height', (this.getHeight() - num) + "px");
		}
	};
	this.getWallHeight = function(){
		if(this.divFloor && this.divWallMain)
			return this.divWallMain.height();
		return WallHeight;
	};
	this.Draw = function() {
		YumeHikkiEngine.getMainWrapper().addClass(this.Title);
		var divElemWallMain=document.createElement('div');
		this.divWallMain = $(divElemWallMain);
		this.divWallMain.addClass('YHRoom').addClass('YHWall');
		var divElemFloor = document.createElement('div');
		this.divFloor = $(divElemFloor);
		this.divFloor.addClass('YHRoom').addClass('YHFloor');
		this.divWallMain.css('height', WallHeight + "px");
		this.divFloor.css('height', (this.getHeight() - WallHeight) + "px");
		this.divWallMain.appendTo(YumeHikkiEngine.getMainWrapper());
		this.divFloor.appendTo(YumeHikkiEngine.getMainWrapper());
	};
	this.getClass = function(){
		return "YHRoom";
	};
	this.setTopLocation = function() {
		return this;
	};
	this.getTopLocation = function() {
		return null;
	};
	this.setBottomLocation = function(loc) {
		return this;
	};
	this.getBottomLocation = function() {
		return null;
	};
}